<template>
    <div class="newsinfo-container" >
        <h3 class="title" >{{newsInfo.title}}</h3>
        <p class="subtitle">
            <span>发表时间:{{newsInfo.add_time | dateFormat}}</span>
            <span>点击:{{newsInfo.click}}次</span>      
        </p>
        <hr>
        <!-- 内容区域 -->
        <div class="content" v-html="newsInfo.content"></div>
        <!-- 评论区域 -->
        <Comment :id="this.newsid"></Comment> 
    </div>
</template>
<script>
    import Comment from '@/components/subcomponents/Comment'
    import {Toast} from 'mint-ui'
     export default {
        data(){
            return {
                newsid:this.$route.params.id,
                newsInfo:{}
            }
        },
        created(){
            this.showNews()
        },
        methods:{
            showNews(){
                this.$http.get('api/getnew/'+this.newsid).then(result =>{
                   
                    if(result.body.status === 0){
                        // console.log(result.body)
                        this.newsInfo = result.body.message[0]
                        // Toast('加载轮播图成功！！')
                        
                    }else{
                        Toast('加载轮播图失败！！')
                    }
                    
                })
            }
        },
        components:{
            Comment
        }
            
        
       
            
        
    }
</script>
<style lang="scss" >
    .newsinfo-container{
        padding: 0 4px;
        .title{ 
            font-size: 16px; 
            text-align: center;
            margin: 15px 0;
            columns: red;
            }
        .subtitle{
            font-size: 13px;
            color: #226aff;
            display: flex;
            justify-content:space-between;
        }
        .content{
            img{
                width: 100%;
            }
        }
    }
</style>